package com.isay.frameworklib.widget.clickitem;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.isay.frameworklib.R;
import com.isay.frameworklib.utils.AnimUtils;
import com.isay.frameworklib.utils.ViewUtils;

/**
 * tabView
 * Created by cywu4 on 2018/8/6.
 */

public class ClickItemView extends LinearLayout implements View.OnClickListener {

    private TextView mTvTitle;
    private TextView mTvSubTitle;
    private ImageView mIvIcon;
    private ImageView mIvRightArrow;

    public ClickItemView(Context context) {
        super(context);
        initialize();
    }

    public ClickItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialize();
    }

    private void initialize() {
        View.inflate(getContext(), R.layout.view_click_item, this);
        mTvTitle = findViewById(R.id.tv_click_item_title);
        mTvSubTitle = findViewById(R.id.tv_click_item_sub_title);
        mIvIcon = findViewById(R.id.iv_click_item_icon);
        mIvRightArrow = findViewById(R.id.iv_click_item_arrow_right);
    }

    /**
     * 设置显示文字
     */
    public void show(int drawableId, CharSequence title, CharSequence subTitle, boolean visibleRightArrow) {
        ViewUtils.setViewBackground(drawableId, mIvIcon);
        mTvTitle.setText(title);
        mTvSubTitle.setText(subTitle);
        mIvRightArrow.setVisibility(visibleRightArrow ? VISIBLE : INVISIBLE);

    }

    public void anim() {
        AnimUtils.scaleWidthRotation(mIvIcon, 1200);
    }


    @Override
    public void onClick(View v) {

    }


}